/*
 * @Author: 谢小康 2170673706@qq.com
 * @Date: 2023-12-17 10:37:23
 * @LastEditors: 谢小康 2170673706@qq.com
 * @LastEditTime: 2023-12-17 17:00:56
 * @FilePath: \My-bolg\server\controller\upload.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
const {
    submitarticle_corve
} = require("../serve/upload")
const Response = require("../util/respanse.js")
/* 添加文章图片地址 */
const submitfile = async (req, res, next) => {
    try {
        const {article_id,file_name} = req.body;
        let data= await submitarticle_corve(article_id,file_name);
        console.log(data.msg);
        if(data.code){
            Response.successresponse(res,{
                code:200,
                message:data.msg
            })
        }else{
            Response.errorresponse(res,{
                code:400,
                message:data.msg
            })
        }
    } catch (error) {
        console.log(error);
        Response.errorresponse(res,{
            code:500,
            msg:"出错了",
            err:error
        })
    }
}

module.exports = {
    submitfile
}